One of the bigger hassles when writing a large-ish C program is pulling function prototypes out of several source files, to make a header file. PROTOS is a tool for doing that. Its output is not a complete header file, but it does most of the really grueling work. It will take a set of C source files and extract and print function prototypes, skipping comments, preprocessor statements, "struct" and "enum" definitions, and global variable declarations. To run PROTOS on some code (for instance, on CODE.C), type protos code.c You can collect the output in a file (in the example below, CODE.P) by using the ">" operator from DOS, followed by the output filename. protos code.c > code.p PROTOS can operate on several source files, or on several file specifications, each naming a number of files by using the "*" or "?" wildcards. protos code1.c code2.c code3.c foo*.c bar*.c > code.p If you want the output of PROTOS to identify the source file and line number on which each function is defined, use the "-n" switch. If you want all non-static functions to be cited as "extern", use the "-e" switch. If you want only the non-statics (or globals), use the "-g" switch, and if you want only the statics, use the "-s" switch. The "-f" switch indicates that a text file contains a list of file specs, one on each line. The name of the text file should immediately follow the "f". For instance, suppose the contents of FLIST.TXT read as follows: CODE1.C CODE2.C CODE3.C FOO*.C BAR*.C Then typing "protos -fflist.txt" will have the same effect as the earlier example. This can help automate the use of PROTOS, for example when using MAKE, or in a batch file. When using the "-f" switch, you can still have file specs on the command line: protos -fflist.txt xyzzy.c plugh*.c Switches can be combined. Typing protos -engfflist.txt will invoke the "-e", "-n", and "-g" switches, so that the output of PROTOS will have "extern"s, file names and line numbers, and static functions will be excluded, as well as the "-f" switch which gets a list of file specs from FLIST.TXT. When combining switches, make sure to use "-f" last, since it will assume the rest of the string is a file spec. ************************************************************ CAVEATS TO USING PROTOS There are three shortcomings to PROTOS in its current state of development. 1. Every now and then it adds an extra blank line, or an occasional line with just a few spaces on it. These can be removed in a text editor. 2. PROTOS requires that all function definitions in the source file be of the newer ANSI variety. This works: int foo(int x, float y) { ..... } This doesn't work: int foo(x, y) int x; float y; { ..... } After a right parenthesis, PROTOS looks for either a semicolon or a left brace. If the left brace appears first, PROTOS calls this a function definition and prints it. If the semicolon appears first, PROTOS thinks this is an "extern" statement or forward reference, and doesn't print it. 3. PROTOS is blind to preprocessor statements. If your source file has several function definitions inside an "#if 0" clause, PROTOS will stupidly attempt to generate prototypes for all of them. 4. PROTOS will become woefully confused if '{' or '}' appears unmatched in a character string (e.g. a format string for printf, sprintf, or fprintf). In PROTOS.C, you'll see some places where I added an extra right brace in a comment to work around this. 5. PROTOS won't know what to do with multi-line #define statements. 6. PROTOS was thrown together in a few days for personal use, and is offered "as is". No claims are made regarding its usefulness, completeness or compliance with any specification for the C language, nor that this bug list is comprehensive.